<template>
	<view class="font title">
		<view class="name">
			<span>*</span>调查名称
		</view>
		<input  v-model="questionnaireNames " placeholder="请输入名称" type="text" />
		<view class="questionnaire_shows_that">
			<h5 style="margin-left: 20rpx;">调查说明</h5>
			<uni-easyinput type="textarea" v-model="questionnaireDescription" placeholder="请输入内容"></uni-easyinput>
		</view>
		<button @click="create">创建调查</button>
		<p v-show="is">名称不能为空</p>
	</view>
</template>

<script>
	export default{
		data() {
			return {
				questionnaireNames :"",
				questionnaireDescription :"",
				is:false
			}
		},
		methods:{
			create(){
				let name = this.questionnaireNames 
				if (!name) {
					this.is = true
					return;
				}
				let data = {"questionnaireNames":name,"questionnaireDescription":this.questionnaireDescription}
				this.$request('/QuestionnairePageController/calcQuestionnaireName',"POST",data)
				.then((res)=>{
					if(res.data.code == 200){
						uni.redirectTo({
							url:'/components/create-questionnaire/edit?title='+name+'&formid='+res.data.data.formId+'&temporary_explain='+this.questionnaireDescription
						})
					}
				})
			}
		}
	}
</script>

<style>
	.title{
		width: 700rpx;
		height: 80rpx;
		margin: 0 auto;
	}
	span{
		color: red;
	}
	.name{
		padding: 10rpx;
	}
	button{
		background-color: #80b156;
		color: white;
		margin-top: 50rpx;
	}
	p{
		margin-top: 20rpx;
		color: red;
	}
	input{
		border: 1px solid #dcdee0;
		border-radius: 10rpx;
		height: 130rpx;
		min-height: 130rpx;
	}
	.questionnaire_shows_that{
		margin-top: 10rpx;
	}
</style>